<?php

namespace app\admin\model;

use think\Model;


class SampleShipmentOrder extends Model
{

    

    

    // 表名
    protected $name = 'sample_shipment_order';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'status_text'
    ];
    

    
    public function getStatusList()
    {
        return ['待发货' => __('待发货'), '已发货' => __('已发货'), '已签收' => __('已签收'), '已取消' => __('已取消')];
    }


    public function getStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
        $list = $this->getStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }

    public function getTaxStatusList($id)
    {
        // return [
        //     ["id" => 0, "name" => "含税", "value" => 0],
        //     ["id" => 1, "name" => "不含税", "value" => 1]
        // ];
        if ($id == '0') {
            return [["id" => 0, "name" => "含税", "value" => 0]];
        } else if ($id == '1') {
            return [["id" => 1, "name" => "不含税", "value" => 1]];
        } else {
            return [
                ["id" => 0, "name" => "含税", "value" => 0],
                ["id" => 1, "name" => "不含税", "value" => 1]
            ];
        }
    }


}
